<?php

namespace App\Model\Divistion;

use App\Model\Model;

class DivisionModel extends Model
{
    protected ?string $connection = 'organ';

    protected ?string $table = 'organ_division';

    protected array $guarded = [];

    public bool $timestamps = true;

    protected array $casts = [
        'id' => 'int',
        'organ_id'  => 'int',
        'division_name' => 'string',
        'division_type' => 'int',
        'status' => 'int',
        'created_at'  => 'date:Y-m-d h:i:s',
        'updated_at'  => 'date:Y-m-d h:i:s',
    ];

    public function scopeWithCustomCondition($query)
    {
        return $query->where('organ_id', getOrganIdByOrganCode());
    }
}